<%@ page language="java" 
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
        
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="f" %>
         
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Le moyen</title>
	</head>
	
	<body>
	
	<%-- On annonce le datasource par défaut pour cette page --%>
	<sql:setDataSource dataSource="jdbc/baehler"/>	
	
	<sql:query var="vMoyens" sql="select * from moyen where moyen_key = ?">
		<sql:param value="${param.key}"></sql:param>
	</sql:query>
	
	<table>
	<c:forEach items="${vMoyens.rows}" var="vRecord">
		<tr>
		<td>${vRecord.moyen.key}</td>
		<td>${vRecord.immat}</td>
		<td>${vRecord.mark}</td>
		<td>${vRecord.type}</td>
		<td><fmt:formatDate value="${vRecord.annee}" type="date" pattern="dd-MM-yyyy"/></td>
		<td>${vRecord.kilometre}</td>
		<td><fmt:formatDate value="${vRecord.expertise}" type="date" pattern="dd-MM-yyyy"/></td>
		</tr>
	</c:forEach>
	</table>
	
	<sql:query var="vInter" sql="select * from intervention where moyen_ref = ? order by date_début DESC">
		<sql:param value="${param.key}"></sql:param>
	</sql:query>
	
	<table>
	<c:forEach items="${vInter.rows}" var="vRecord">
		<tr>
		<td>${vRecord.moyen.ref}</td>
		<td>
			<c:url var="vUrl" value="/CetteIntervention.jsp">
				<c:param name="key" value="${vRecord.inter_num}"></c:param>
			</c:url>
			<a href="${vUrl}">${vRecord.inter_num}</a>
		</td>
		<td>${vRecord.desc_non_défini}</td>
		<td>${vRecord.cust_ref_num}</td>
		<td><fmt:formatDate value="${vRecord.date_début}" type="date" pattern="dd-MM-yyyy"/></td>
		<td>${vRecord.kilometre}</td>
		<td><fmt:formatDate value="${vRecord.date_fin}" type="date" pattern="dd-MM-yyyy"/></td>
		</tr>
	</c:forEach>
	</table>

</body>
</html>